import moduleRegist from '@/utils/moduleRegist';
import {
  module as permissionModule
} from './module';

const ListView = resolve => {
  require(['./ListView'], resolve);
};

const Layout = resolve => {
  require(['./Layout'], resolve);
};

export default [
  /** 配置管理路由 */
  {
    path: 'permission',
    redirect: 'permission/list',
    component: Layout,
    meta: {
      title: '权限',
      name: '权限',
      permission: 'auth:menu:permission:list',
      componentName: 'PermissionLayout',
      keepAlive: true,
      icon: 'md-lock',
      show: false
    },
    beforeEnter: (to, from, next) => {
      moduleRegist(permissionModule);
      next();
    },
    children: [{
      path: 'list',
      component: ListView,
      meta: {
        title: '权限列表',
        name: '权限',
        breadcrumb: '权限列表',
        permission: 'auth:permission:query',
        keepAlive: true,
        componentName: 'PermissionListView',
        icon: 'md-lock'
      }
    }]
  }
];
